<template>
	<view>
		<cu-custom class="bgmains" bgColor="" :isBack="true">
		    <view slot="content">{{data.userinfo.nickname}}的团队</view>
		</cu-custom>
		
		
		<image :src="fileUrl+'dis/bg.png'" style="width: 100%;" mode="widthFix"></image>
		<view class="padding" style="position: absolute;top: 15%;width: 100%;">
			<view class="flex margin-bottom">
				<image class="avatar" :src="data.userinfo.avatar"></image>
				<view class="text-lg text-bold margin-top">{{data.userinfo.nickname}}</view>
			</view>
			<view class="userbox flex">
				<view style="margin-left: 200rpx;">
					<view class="title">加入时间</view>
					<view class="date">{{data.userinfo.create_time}}</view>
				</view>
				<view class="margin-left">
					<view class="title">下级成员</view>
					<view class="num">{{data.count}}人</view>
				</view>
			</view>
		</view>
		
		<view class="position">
			<view class="margin box padding" v-for="(item,index) in dataList" :key="index">
				<view class="flex align-center">
					<image class="avatar" :src="item.avatar"></image>
					<view class="userinfo">
						<view class="nickname">{{item.nickname}}</view>
						<!-- <view class="date flex align-center">{{item.create_time | formatDate}} <view class="margin-left-xl">贡献收益<text class="text-lg text-bold">￥{{item.money}}</text></view></view> -->
						<view class="date flex align-center">{{item.create_time | formatDate}} </view>
					</view>
				</view>
			</view>
		</view>
		
	</view>
	
</template>

<script>
	var app = getApp()
	export default{
		data(){
			return{
				page:1,
				is_loadmore:true,
				dataList:[],
				data:{}
			}
		},
		onLoad(options) {
			console.log(options)
			this.getLst(options)
		},
		onReachBottom() {
			if(this.is_loadmore)
			{
				this.page++
				this.getLst()
			}
			else{
				uni.showToast({
					title:'没有更多数据~',
					icon:'none'
				})
			}
		},
		methods:{
			getLst(options) {
				const self = this;
				app.globalData.util.request({
					url: 'Distribution/childteam',
					data: {
						limit:10,
						page:self.page,
						u_id:options.uid
					},
					success(res) {
						self.data = res.data.data
						if(res.data.data.list.length<10)
						{
							self.is_loadmore = false
						}
						self.dataList = self.page==1?res.data.data.list:[
							...self.dataList,...res.data.data.list
						]
					}
				}, true);
			},
		}
	}
</script>

<style lang="scss">
	.bgmains {
	    background: #0000 !important;
	    position: absolute;
	}
	.avatar{
		width: 150rpx;
		height: 150rpx;
		border-radius: 50%;
		margin-right: 10rpx;
		border: 10rpx solid white;
	}
	.userbox{
		background-color: white;
		border-radius: 20rpx;
		padding: 30rpx;
		margin-top: -80rpx;
		.title{
			color: #121212;
			font-size: 26rpx;
			margin-bottom: 10rpx;
		}
		.num{
			color: #FF4C49;
			font-size: 28rpx;
		}
		.date{
			margin-top: 16rpx;
			color: #999999;
			font-size: 24rpx;
		}
	}
	.position{
		margin-top: -50rpx;
		position: relative;
		z-index: 99;
	}
	.box{
		background-color: white;
		border-radius: 10rpx;
		.avatar{
			width: 90rpx;
			height: 90rpx;
			border-radius: 50%;
			margin-right: 20rpx;
		}
		.userinfo{
			flex-grow: 1;
			.nickname{
				font-size: 30rpx;
				color: #121212;
				font-weight: bold;
			}
			.date{
				margin-top: 10rpx;
				color: #666666;
				font-size: 22rpx;
				text{
					font-size: 28rpx;
					color: #FF4C49;
				}
			}
		}
	}
</style>